package cc.yugu.yhdw.common.protocol.msg02;

import cc.yugu.yhdw.common.protocol.MsgCode;
import cc.yugu.yhdw.common.tool.netty.TypeOperator;
import io.netty.buffer.ByteBuf;

import java.util.ArrayList;
import java.util.List;

public class Msg021000026 extends Msg021 {

    public List<Order> orderList = new ArrayList<Order>();

    @Override
    public int getMsgCode() {
        return MsgCode.MSG_021000026.getCode();
    }

    @Override
    public void readData(ByteBuf buffer) {
        int size = buffer.readInt();
        for (int i = 0; i < size; i++) {
            Order order = new Order();
            order.read(buffer);
            orderList.add(order);
        }
    }

    public class Order extends TypeOperator {
        public int price;
        public String firstBoxNum;
        public String secondBoxNum;
        public long openFirstBoxTime;
        public long openSecondBoxTime;
        public long putFirstBatteryTime;
        public long takeSecondBatteryTime;
        public String firstBatteryId;
        public String secondBatteryId;
        public long createTime;
        public int customerId;
        public String customerMobile;

        public void read(ByteBuf buffer) {
            price = buffer.readInt();
            firstBoxNum = readString(buffer);
            secondBoxNum = readString(buffer);
            openFirstBoxTime = buffer.readLong();
            openSecondBoxTime = buffer.readLong();
            putFirstBatteryTime = buffer.readLong();
            takeSecondBatteryTime = buffer.readLong();
            firstBatteryId = readString(buffer);
            secondBatteryId = readString(buffer);
            createTime = buffer.readLong();
            customerId = buffer.readInt();
            customerMobile = readString(buffer);
        }
    }
}
